From ff712d654d6b6cb6deb0da538d7a8d9c4318e5d3 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 10 May 2006 16:05:24 +0100 Subject: [PATCH] Reset Cirrus device model `VRAM' whenever a VGA/SVGA mode switch occurs. If you change the video resolution on a Windows XP guest such that it uses fewer bytes of VRAM (either by using fewer bytes per pixel or by lowering the resolution) then some window backgrounds will become corrupted. This happens because the Windows XP Cirrus Logic driver assumes that VRAM is initialized to 0xff whenever the video mode switches between VGA and SVGA. Signed-off-by: Donald.D.Dugger@intel.com --- tools/ioemu/hw/cirrus_vga.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/ioemu/hw/cirrus_vga.c b/tools/ioemu/hw/cirrus_vga.c index 2786c3fae7..fda8042771 100644 --- a/tools/ioemu/hw/cirrus_vga.c +++ b/tools/ioemu/hw/cirrus_vga.c @@ -1187,6 +1187,17 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value) s->hw_cursor_y = (reg_value << 3) | (reg_index >> 5); break; case 0x07: // Extended Sequencer Mode + /* Win2K seems to assume that the VRAM is set to 0xff + * whenever VGA/SVGA mode changes + */ + if ((s->sr[0x07] ^ reg_value) & CIRRUS_SR7_BPP_SVGA) + memset(s->vram_ptr, 0xff, s->real_vram_size); + s->sr[0x07] = reg_value; +#ifdef DEBUG_CIRRUS + printf("cirrus: handled outport sr_index %02x, sr_value %02x\n", + reg_index, reg_value); +#endif + break; case 0x08: // EEPROM Control case 0x09: // Scratch Register 0 case 0x0a: // Scratch Register 1 @@ -3021,10 +3032,6 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci) } s->cr[0x27] = device_id; - /* Win2K seems to assume that the pattern buffer is at 0xff - initially ! */ - memset(s->vram_ptr, 0xff, s->real_vram_size); - s->cirrus_hidden_dac_lockindex = 5; s->cirrus_hidden_dac_data = 0; -- 2.30.2